home *** CD-ROM | disk | FTP | other *** search
-
- In this file, you will find all the global variables used in Getleft.
-
-
- As usual, this file is Copyright 1999-2002 AndrΘs Garcφa and its contents are
- distributed under the terms of the GPL, which means, among other things, that
- it comes with no warranty, if the contents of this file blow up your computer
- killing some passersby, it will be your sole fault.
-
- directories:
- Array with data about the local directories Getleft uses.
- - directories(local): directory of the file Getleft is processing.
- - directories(base): directory where you told Getleft to store the
- download.
-
- dirGetleft:
- Array containing the different directories Getleft is in.
- - dirGetleft(main): directory where 'Getleft.tcl' is in.
- - dirGetleft(scripts): where the scripts like 'Ayuda.tcl' are in.
- - dirGetleft(doc): where the documentation is.
- - dirGetleft(images): for the images of the program that are common
- among themes.
- - dirGetleft(icons): for the images that change between themes.
- - dirGetleft(languages): for the translations of Getleft.
- - dirGetleft(conf): where the logs and such are kept.
- - dirGetleft(lastDir): where the last downloaded site was saved.
- - dirGetleft(toolDir): the directory where we last used the 'Purge
- files' or 'Restore orig' tools.
-
- done:
- Not a real global variable, I use it in some dialogs so they can
- grab focus until the value of 'done' changes.
-
- errorCode:
- Global variable where Tcl puts error info.
-
- getleftState:
- Array with information about Getleft present state:
- - encoding: charset enconding of the first page downloaded.
- - getleftState(autoDown): '1' if Getleft is in full automatic
- download.
- - getleftState(filesChosen): '1' if the user has already chosen which
- links to download.
- - getleftState(delayedDown): '1' if the download being done has been
- programmed.
- - getleftState(delaySet): '1' if there is a download programed for
- future downloading.
- - getleftState(downloading): '1' if Getleft is downloading a site.
- - getleftState(errorFound): '1' if there was any error during the
- download.
- - getleftState(mapDone): If the user request a map of the site, this
- will be one if the map is already done.
- - getleftState(chosenLinks): A list of '0' and '1' representing the
- links chosen in the 'Choose files' dialog.
- - getleftState(mapLinks): A list with links the user told Getleft to
- follow to create the map.
- - getleftState(os): The platform we are in: 'win', 'mac' or 'unix'.
- 'mac' means MacOs X, not classic.
- - getleftState(startNow): '1' if the url has to be downloaded as soon
- as the data is entered, '0' if it only has to be in the queue.
- - getleftState(url): The current url being downloaded.
- - getleftState(urlQueue): A list with all the urls that are queued to
- be downloaded.
- - getleftState(urlsToAuto): A list with all the urls that are selected
- to be downloaded in automatic mode.
-
- env:
- Global variable in which Tcl keeps the enviromental variables.
-
- indexButtons, indexDialgos and indexMenus:
- Arrays, the key of each element is the label of a widget, the content is
- the index of the character of the label that should appear underwriten.
-
- labelButtons
- Array with the labels for the buttons in the language chosen by the user.
-
- labelDialogs:
- Array with the labels of the dialogs in the language chosen by the user.
-
- labelMenus:
- Array with the label of the menus in the language chosen by the user.
-
- labelMessages:
- Array with the messages in the language chosen by the user.
-
- labelMonths:
- Array with the names of the months in the language chosen by the user.
-
- labelTitles:
- Array with the titles of the windows in the language chosen by the user.
-
- getleftOptions:
- Array that keeps the user options that affect Getleft behaviour,
- most are boolean variables.
- - getleftOptions(lang): Code of the language Getleft is using.
- - getleftOptions(pauseNow): Set to '1' when the user want to pause the
- file as it is being downloaded, it is used in case instead of downloading
- we are processing a file.
- - getleftOptions(pauseFile): If '1' downloading will pause after the
- current file.
- - getleftOptions(pausePage): If '1' downloading will stop after getting
- all links in the current page.
- - getleftOptions(proxy): '1' if Getleft should use proxies.
- - getleftOptions(httpProxy): Address and port of the proxy for http
- requests.
- - getleftOptions(ftpProxy): Address and port of the proxy for ftp
- requests.
- - getleftOptions(sameProxy): '1' if Getleft has to use the same proxy
- for http and ftp.
- - getleftOptions(useAuthProxy): '1' if you need authentificacion to use
- the proxy.
- - getleftOptions(saveAuthPass): '1' if you want Getlef to save your
- password to the proxy.
- - getleftOptions(proxyUser): Your username to the proxy.
- - getleftOptions(proxyPass): and your password.
- - getleftOptions(resumeSites): List with the domains of the sites whose
- download was interrupted and will be completed in the future.
- - getleftOptions(stopPage): If '1' downloading will stop after the
- current page.
- - getleftOptions(stopFile): If '1' downloading will stop after the
- current file.
-
- downOptions:
- Array that keeps the user options that affect the current download,
- most are boolean variables.
- - downOptions(cgi): Whether to follow link to cgi pages.
- - downOptions(dir): If '1' Getleft will download files that are above
- the first one in the directory structure of the remote site.
- - downOptions(exlevels): Number of levels to follow for external sites.
- - downOptions(external): '1' if Getleft should follow links outside
- the site.
- - downOptions(filter): The filter used to decide which files to download.
- - downOptions(images): Takes the values '0', '1', '2' in case you want to
- download all images, only thumbnails or without thumbnails.
- - downOptions(levels): number of levels Getleft will recursively download.
- - downOptions(map): If '1' Getleft will do a map of the site.
- - downOptions(onlyHtml): If '1' only html pages will be downloaded.
- - downOptions(update): Whether the downloading is updating a former one.
-
- downOptionsTemp:
- Contains the same info as 'downOptions', it is used when entering a new url in
- the queue, so that we don't pollute the options of the download taking place.
-
- defautlDownOptions:
- Contains the same elements as downOptions, it keeps the options set as
- default by the user.
-
- siteUrl:
- Array with information about the remote site of the url entered by the user.
- - siteUrl(url): Url entered by the user.
- - siteUrl(prot): Protocol of the site.
- - siteUrl(www): Name of the site, e.g, www.scriptics.com
- - siteUrl(dir): Directory that holds the file, e.g, /pub. The root
- directory is represented by an empty string.
- - siteUrl(base): Directory of the file you entered.
-
- siteIndex:
- In case we ask Getleft to get the map of the site, when it's done, siteIndex
- is the number of links of the site plus one.
-
- siteMap:
- Array with the map of the site, it has a row for every link, the columns:
- - 'level': levels Getleft descended to find that link.
- - 'url': link.
- - 'descrip': description of the link.
-
- supportedLang:
- Array with the languages Getleft supports. It keeps the name of
- the language, the two-letter code to identify it, and the encoding
- requiered for its font. For example, for English we have:
- - supportedLang(English) == en
- - supportedLang(en) == iso8859-1
- - supportedLang(langList) List with the names of all the
- languages to which Getleft has been translated.
-
- tcl_platform
- Array in which Tcl keeps the info about the platform it is running in.
-
- urlIndex:
- The last Urls entered are keep in the list 'urlHistory', this variable
- keeps the index in which the next url will be entered.
-
- urlHistory:
- List with the last urls entered.
-
- urlsToDownload:
- An array with information about the urls in the queue:
- - urlsToDownload(the_url_entered): It simply contains a '1' as proof
- we have the data.
- - urlsToDownload(the_url_entered,dir): The directory where it will be
- stored.
- - urlsToDownload(the_url_entered,resume): How many times it has already
- been resumed.
- - urlsToDownload(the_url_entered,options): A list with the downOptions
- for the download as given by: array get downOptions.
-
-
-
- From now on you will find the variables used in namespaces
-
-
-
- In case you are wondering:
- - Ayuda == Help
- - Ccombinado == Cuadro combinado == combobox
- - Descargar == Download
- - Dialogos == Dialogs
- - Herramientas == Tools
- - Ventana == Window
- - Rizo == Curl
- - Progreso == Progress
-
- Namespace Ayuda
-
- None yet
-
- Namespace Herramientas
-
- - ip:
- Every element of this array contains the path to one of the entries in which
- you put the network address and port of the proxy.
-
- - n:
- In the events of the proxy configuration dialog, 'n' represents the next
- entry.
-
- - fileLog:
- - fileLog(file): File with the error log.
- - fileLog(win): Top level window with the error log.
- - fileLog(text): Path of the text widget where the log is written.
-
-
- Namespace Ventana
-
- - action
- Either 'head' or 'body' depending on whether Getleft is getting the
- headers or the body of a link.
-
- - afterId
- Keeps the handle of the event which updates the progress bar.
-
- - file
- File name and path in the local computer of the link being downloaded.
-
- - link:
- Link being downloaded.
-
- - menus:
- Path of the menus for the 'Pause' and 'Stop' menus buttons.
-
- - mother
- Referrer page of the link.
-
- - waitingPid
- The identifier of the event to change the title of the downloading
- window while we are waiting after a timout.
-
- - window
- Array with the paths of the elements of the downloading window:
- - window(top): The toplevel path.
- - window(url): Label with the site domain name.
- - window(dir): Label with the directory of the file in the remote site.
- - window(file): Label with the name file.
- - window(left): Label where the time left of downloding.
- - window(bar): The path of the progress bar.
- - window(cancel): The path to the cancel button.
- - window(pause): The path to the pause button.
- - window(resume): The path to the resume button.
-
-
- Namespace Rizo
-
- - curlError
- In case 'curl' returns an error, this variable will have the error code.
-
- - curlReport:
- Array that keeps some information about the download being done by curl:
- - scurlReport(end): curl has finished downloading the link.
- - curlReport(left): In the long reports, curl estimates how much time of
- downloading is left, this time is kept in this
- variable.
- - curlReport(nextFile): The contents of this variable are incremented,
- when Getleft can start downloading a new link.
- It is used in a 'tkwait' statement.
- - curlReport(pause): '1' while the user asks for the downloading to be
- paused.
- - curlReport(percentage): Percentage of the file downloaded.
- - curlReport(speed): The speed of the downloading.
- - curlReport(stop): '1' if the user wants to stop the downloading.
-
- - errorMessage: Gets the error message raised by 'curl' or the server.
-
- - leftIndex and speedIndex
- On version 6.4 curl changed the format of its report, these variables hold
- the place in that report of the time left and the current speed.
-
- - meta:
- Array with the headers of the requested link:
- - meta(code): Error code return by the server.
- - meta(content): MIME type of the link, for example "text/html"
- - meta(error): Error message returned by the server.
- - meta(lastModified): Date of the last time the linked file was modified.
- Unfortunately, some servers don't return this info
- with the headers.
- - meta(relocate): '1' if the headers say that the link has been relocated.
- - meta(totalBytes): Size of the link
- - meta(versionServer): version of http used by the server.
-
- - pipe:
- Handle of the pipe used to write the file.
-
-
- Namespace Dialogos
-
- This namespace takes care of the dialog used to choose a directory. It is
- adapted from a example found in 'Practical Programming in Tcl/Tk' by Brent
- Welch (http://www.beedub.com), I made most of the changes to it a few years ago,
- when I knew even less about Tcl than I know now, so please, don't blame Mr Welch
- for whatever you find there.
-
- - fileselect
- Array with information about the elements of the dialog window.
- - fileselect(dir): Current directory.
- - fileselect(dirEnt): Path of the entry widget in which the current
- directory is shown.
- - fileselect(done): This is used as a marker in a tkwait statement, if
- it equals '1' the user has entered something, if
- it equals '0' the user has canceled the action.
- - fileselect(path): Path entered by the user.
- - fileselect(pathEnt): Path of the entry where the user can write the
- chosen directory.
-
-
- Namespace Ccombinado
-
- The combobox widget is defined here.
-
- - cbArgs
- Array with the parameters passed to the widget:
- - cbArgs(-default): Whatever will appear in the entry when the combobox
- is mapped
- - cbArgs(-erasable): '1' if the user can delete items from the list, '0'
- if he can't.
- - cbArgs(-width): Width of the entry in characters.
- - cbArgs(items): List with the items, the one you should check if you
- allow the user to delete things. It seems that Tcl/Tk
- 8.3 has a variable for this in the ListBox widget
- but, for the time being, we will have to keep it.
-
-
- Namespace HtmlParser
-
- - entities: array with the mapping of the Html character entities, for example:
- 'entities(lt)==>'
-
- - pageEncoding:
- if the page includes the encoding used in a meta tag, this variable will
- have it, otherwise, if will have an empty string.
-
- - links:
- array with information about the links found in a page, indexes begin at '1':
- - descrip: The description for the link.
- - file: The link as it appears in the page.
- - type: What kind of link, so far it can be 'image', 'thumb' or nothing
- at all.
- - ok: boolean, '1' if the file is going to be downloaded, '0' if it has
- been filtered.
- - shown: boolean, '1' if the link is shown in the 'Choose files' dialog.
- - url: The full url of the link.
-
- - nLinks:
- Number of links plus one found in the last page processed.
- So if you want to use it, you need something like:
-
- for {set i 1} {$i<$nLinks} {incr i} {}
-
-
- Namespace Commands
-
- - workFile:
- Array used to load a file into memory, it's structure:
- - workFile(0)=="First line of the file"
- ............
-
- - sedChanges:
- Array with the changes that will be applied to the file.
- The 'sed' prefix comes from the time I used to call 'sed' to do this
- job for me. It's structure:
- - sedChanges(0,old)==Regular expresion with the string to change.
- - sedChanges(0,new)==The new string.
-
- - sedIndex:
- Index of 'sedChanges' in which the next change to make will be placed.
-
- - workFileLines:
- A list with the lines in WorkFile() which contain a '=' sign, here is
- where we will look for links to change. Problem is the links don't have
- to be in the same line of the file, they can be written like:
- <a
- href =
- "link.html">something
- </a>
- Just because I have never seen it, doesn't mean it isn't a bug waiting
- to happen.
-
- - startLine:
- Index of the workFileLines list in which Getleft will start trying to
- match the change.
-
-
- Namespace Descargar
-
- - filesNotFound
- Array where Getleft stores the links which the server refuses to serve,
- like when it doesn't find them or the are forbidden or whatever. They
- are stored as with 'filesProcessed'
-
- - filesProcessed
- Array where Getleft stores which files have already been processed for
- links. The key is the full name of the file, the value is the level of
- recursion in which the link was found. If the levels of recursion are not
- limited Getleft uses this not to process the same file twice, if they are,
- it will process it more than once if it finds it again at a lower level.
- For example:
- set filesProcessed(/home/Andres/download/index.html) 1
-
- - filesRelocated
- Array with the urls from the site that are realocated, so that we only
- ask once for them, in the descriptions, 'url' is the original link.
- - filesRelocated(link,url): New url of the link after relocation.
- - filesRelocated(link,ok): Whether to follow it or not.
- - filesRelocated(link,file): The local file for the relocated link.
- - filesRelocated(link,html): Whether the file in html or not.
-
- - relocated:
- In case Getleft finds a file that has been relocated, it will put all
- necessary info in this array.
- - relocated(ok): '1' if there has been a relocation.
- - relocated(url): The new file, including path, to download.
-
- - updated
- When the 'Update' option is checked this array will keep track of
- the files that have already been updated.
-
- For example, updated(/home/Andres/bounty/images/something.jpg) == 1
-
-
- Namespace Progreso
-
- - pbArgs:
- Array with data about the progress bars defined, the first index is the
- path of the bar:
- - path,-width: width of the bar.
- - path,-height: height of the bar.
- - path,-numbers: '1' if the percentage completed should be shown in the
- middle of the bar.
- - path,-bg: background color of the bar.
- - path,-fg: foreground color of the bar.
- - path,whiteNumber: id of the black text in the middle of the bar.
- - path,blueNumber: id of the white text in the middle of the bar.
- - path,blackX: X coord of the black text
- - path,blackY: Y coord of the black text
- - path,whiteX: X coord of the white text
- - path,whiteY: Y coord of the white text
-
- Namespace Cookies
-
- - cookies:
- Array with info about the cookies stored:
- - index,domain: Site the cookie applies to.
- - index,share: Whether the cookie is shared among the sites of the domain.
- - index,path: Path within the domain.
- - index,secure: Either 'TRUE' or 'FALSE'.
- - index,expires: The moment, in seconds since 1-Jan-1970, the cookies expires.
- - index,cookie: The name of the cookie.
- - index,value: The value of the cookie.
-
-
- Namespace ChooseFiles
-
- activeLink:
- The path to the checkButton where the user right-clicked to show
- the context menu. It is used to know which line to deselect when
- the menu closes.
-
- win:
- - win(text): path to the text widget where the links are shown
- - win(menu): path to the context menu.
- - win(top): path to the toplevel window of the dialog.
-
- refererUrl:
- The url of the page from which we have taken the links.
-
-
- Namespace mainWin
-
- iconImages:
- Array with the images for the icons in the taskbar.
-
- mainWin:
- Array with the paths of several elements of the window,
- like the listbox, the scroll bars, ...
-
- menus:
- Array with the path of the menus.
-
- taskbar:
- Array with the paths of the buttons in the taskbar.
-
-
- Namespace getLog
-
- fileTaskbar:
- Array with the path of the buttons in the taskbar of the file log.
-
- fileLog:
- Array with the path of the elements of the file log toplevel.
-
- siteLog:
- Array with the paths of elements of the site log toplevel.
-
- siteTaskbar:
- Array with the path of the buttons in the taskbar of the site log.
-
- urlLog:
- Array with data about the url in the log.
- - urlLog(urlList): A list with the urls.
- - urlLog($url,localDir): Directory in which the site was saved.
- - urlLog($url,date): Moment in which we finished the download.
- - urlLog($url,options): A list with the options used for the download.
- - urlLog($url,keep): '0' if we can delete it when the log is full.
-
-
- Namespace Delay
-
- window:
- Array with the path of several widget in the dialog.
- - window(endHour): path of the spinbox with the hour to end.
- - window(endMinute): path of the spinbox with the minute to end.
- - window(startHour): path of the spinbox with the hour to start.
- - window(startMinute): path of the spinbox with the minute to start.
- - window(win): Path of the toplevel window of the dialog.
-
- delayedDownload:
- Array with info about the programmed download.
- - delayedDownload(startTime): Time in seconds from '01-01-1970' in which
- the next programmed download will begin.
- - delayedDownload(endTime): Time in seconds from '01-01-1970' in which
- the programmed download will end.
- - delayedDownload(startEvent): Tcl event that will start the download.
- - delayedDownload(endEvent): Tcl event that will end the download.
- - delayedDownload(noEnd): '1' if there is no time limit.
- - delayedDownload(days): '1' if you define the days in which to download.
- - delayedDownload(how): How the download will stop if there is a time limit:
- - 0: Inmediately.
- - 1: After the current file is downloaded.
- - 2: After all links in the current page are downloaded.
- - delayedDownload(monday): '1' if it will be downloaded on Monday
-
- delayedDownloadTemp:
- Array with the same info as 'delayedDownload', this is the one the
- dialog works with, so that if you cancel the dialog, the real one
- won't be polluted with the rejected changes.
-
-
-